/*****************************************************************/
//Display monitors what is shown on the screen. It does the map, enemies,
//the player, what screen is showing, etc
// Tyler Wozniak & Andrew Hall
/**************************************************************/

#ifndef DISPLAY_DEF
#define DISPLAY_DEF
#include "imports.h"
#include "Map.h"
#include "Enemy.h"
#include "Player.h"


#pragma region Window Size Defines
#define MAX_HEIGHT 17 //Max size for the "display" window height
#define MAX_WIDTH 79 //Max size for the "display" window width
#define MAIN_WIDTH 55 //Max width for the main display screen
#define HERO_R 8 //Hero's row position (center of main display)
#define HERO_C 27 //Hero's col position (same)
#define MAX_SIGHT_SQUARED 49 //Max sight of the player
#pragma endregion

class GameManager;

class Display
{
private:
	GameManager* gameRef; //Reference to the game object
	char** displayArray; //The array of characters to display
	static const char WALL = char(219); //The character representing a Wall
	static const char FLOOR = '.'; //Character representing the Floor
	static const char HERO = '@'; //for Null Ptr!
	int rowConv; //Int representing the row Conversion from map pos to display pos
	int colConv; //Int representing the col conversion ....
	queue<string> allMessages; //STL queue holding all the messages!
	static const int MAX_PLAYER_MESSAGES = 8; //Max messages to print during turns
	Queue<string>* currentMessages; //My generic queue holding current messages to print
	vector<string> menuOps; //STL vector of menu options

	//Private functions
	void drawDisplayArray(Map& curMap);
	void drawDisplayArrayRow(int row, Map& curMap);
	void cleanDisplayArray();
	void mapToDisplay(Map& curMap, int heroRow, int heroCol);
	string* UItoArray(string uiArr[],const Player& curP);
	void showAllMessages(void);
	void setuiColor(int i);
	void printMenu();
	
public:
	map<char,int> displayCharColors; //STL map of colors for characters

	enum { BLACK, BLUE, GREEN, CYAN, RED, MAGENTA, BROWN, LIGHTGREY, DARKGREY,
		 LIGHTBLUE, LIGHTGREEN, LIGHTCYAN, LIGHTRED, LIGHTMAGENTA, YELLOW, WHITE };
	Display(GameManager& game);
	void initColors();

	void printErrorMessage(string out);
	void drawCurrentScreen();
	void addPlayerMessage(string s);
	void showPlayerMessages(void);
	void printTitle();
	void setMenuOp(char in);
	string getMenuOp();
	void setColor(int colorEnum);
	void printCredits();
	~Display(void);

	//Converts an int to a string
	static string intToString( int i )
	{
		string s;
		stringstream out;
		out << i;
		s = out.str();
		return s;
	}
};

#endif